<!DOCTYPE html>
<html lang="zh-cn">

<head>
    <meta charset="utf-8">
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>545在线-关于</title>
    <link href="../public.css" rel="stylesheet">
</head>

<body style="text-align: center">

    <div id="settings" style="height:100vh;overflow-y:scroll;">
        <img src="../icon.webp" style="margin-top:10vh;width:50vw;max-width:256px;border-radius: 20px ;">
        <H2>545在线</H2>
        <H4 id="update" style="padding:10px;">正在检查更新...</H4>
        <H5>程序：<a href="https://qinlili.bid" target="_blank">琴梨梨</a></H5>
        <H6 style="padding:10px;">可以不关注琴梨梨，但请一定要关注帅比笙歌超可爱OvO，直播房间号545，准时收看国风温柔可爱铸币的塔宝直播！</H6>
        <H6 style="padding:10px;">本项目已被塔宝<a href="https://www.bilibili.com/video/BV15Z4y1h75C"
                target="_blank">亲自巡回</a>，好耶！</H6>
        <H6 style="padding:10px;">以下boba在本项目开发中做出了不可磨灭的贡献，排名不分先后
            <br>陆以桥（渣男）
            <br>樱乃笙曦大铸币
            <br>孙小花
            <br>杂音先生
            <br>落玄汐
            <br>皇珈顶碗人
            <br>柑橘乌云
            <br>鹌鹑弟
        </H6>
        <br>
        <p><a href="https://icp.gov.moe/?keyword=20225033" target="_blank">萌ICP备20225033号</a></p>
        <br>
        <br>
    </div>
    <script>
        const sleep = delay => new Promise((resolve) => setTimeout(resolve, delay))
        const checkUpdate = async () => {
            await sleep(1000);
            let versionJson = await (await fetch("../version.json?ForceNoCache=1")).json();
            let currentVersion = await (await fetch("getVersionWorker")).text();
            if (!(currentVersion.length >= 8)) {
                //版本号异常
                currentVersion = false;
            }
            if (versionJson.success) {
                if (versionJson.latest == currentVersion) {
                    document.getElementById("update").innerText = "当前已经是最新版本:" + currentVersion;
                } else {
                    if (versionJson.azusa_patch_avaliable == currentVersion) {
                        document.getElementById("update").innerText = "正在尝试省流量更新到:" + versionJson.latest;
                    } else {
                        document.getElementById("update").innerText = "正在尝试全量更新到:" + versionJson.latest;
                    }
                    await navigator.serviceWorker.register('../sw.js', { scope: '/' });
                    await sleep(3000);
                    checkUpdate();
                }
            } else {
                if (currentVersion) {
                    document.getElementById("update").innerText = "检查更新失败,当前版本为:" + currentVersion;
                } else {
                    document.getElementById("update").innerText = "检查更新失败,当前版本不是正式版本,请删除本站全部缓存重新加载";
                }
            }
        }
        checkUpdate();
    </script>
</body>

</html>